import validate from '../../../utils/validation'

// 校验规则
const SCHEMA = {
  type: 'object',
  required: ['code', 'password', 'email'],
  properties: {
    code: {
      type: 'string',
      maxLength: 6,
      minLength: 6,
    },
    password: {
      type: 'string',
      maxLength: 255,
      minLength: 6,
    },
    email: {
      type: 'string',
      pattern: '^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(.[a-zA-Z0-9_-]+)+$',
    },
  },
}
/**
 * 获取检验函数
 * @param data
 * @returns
 */
function validation(data = {}) {
  return validate(SCHEMA, data)
}
export default validation
